#Library
library(dplyr)
library(tidyverse)
library(openxlsx)
library(gt)
library(RMySQL)
library(kableExtra)
library(ggpubr)
library(ggplot2)
library(ggpubr)
options("scipen" = 100)
#Data Loading (DB access)
getwd()
## [1] "C:/Users/D_AIO2104_01/Desktop"
# DBcon <- dbConnect(
# MySQL(),
# user = 'morderdba@morderdb',
# password = '!m@rder2@20',
# host = 'morderdb.mysql.database.azure.com',
# dbname = 'morder_dataon',
# charset='euckr'
# )
# dbSendQuery(DBcon, "SET NAMES utf8;")
# dbSendQuery(DBcon, "SET CHARACTER SET utf8;")
# dbSendQuery(DBcon, "SET character_set_connection=utf8;")
#
# data_morder <- dbGetQuery(DBcon,"select * from `회원_마스터_v2` where ymd='2021-05-16';")
setwd("C:/Users/D_AIO2104_01/Desktop")
data_morder <- read.xlsx("data_morder.xlsx", startRow=1, sheet=1)
head(data_morder) %>% gt()
| 회원일련번호 |
이름 |
성별 |
나이 |
가입일 |
가입경과일 |
거주지 |
그룹기준브랜드 |
그룹기준브랜드명 |
주문회수_전체 |
결제금액_전체 |
빌단가_전체 |
첫주문일 |
최근주문일 |
최근주문경과일 |
회수_1년 |
금액_1년 |
회수_6개월 |
금액_6개월 |
회수_테이블 |
금액_테이블 |
회수_픽업 |
금액_픽업 |
회수_배달 |
금액_배달 |
회수_1년_테이블 |
회수_1년_픽업 |
회수_1년_배달 |
회수_6개월_테이블 |
회수_6개월_픽업 |
회수_6개월_배달 |
엠페이등록 |
스탬프적립 |
온라인쿠폰발급 |
온라인쿠폰사용 |
오프라인쿠폰발급 |
오프라인쿠폰사용 |
주중 |
주말 |
점심 |
스윙 |
저녁 |
기타시간 |
기간구분 |
ymd |
| 232 |
우정식 |
남자 |
51 |
2020-09-10 00:00:00 |
249 |
경기 고양시 일산동구 숲속마을로 195 |
0 |
전체 |
3 |
42900 |
14300 |
2020-11-20 |
2020-12-22 |
146 |
3 |
42900 |
3 |
42900 |
3 |
42900 |
0 |
0 |
0 |
0 |
3 |
0 |
0 |
3 |
0 |
0 |
Y |
0 |
10 |
1 |
3 |
0 |
3 |
0 |
2 |
0 |
1 |
0 |
A |
2021-05-16 |
| 90 |
김지영 |
여자 |
40 |
2020-06-24 00:00:00 |
327 |
서울특별시 송파구 동남로6길 29-4 |
0 |
전체 |
0 |
0 |
0 |
NA |
NA |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
NA |
0 |
2 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
A |
2021-05-16 |
| 522 |
김창훈 |
남자 |
38 |
2020-12-21 00:00:00 |
147 |
서울특별시 성북구 고려대로17가길 64 |
0 |
전체 |
2 |
52600 |
26300 |
2020-12-22 |
2020-12-22 |
146 |
2 |
52600 |
2 |
52600 |
2 |
52600 |
0 |
0 |
0 |
0 |
2 |
0 |
0 |
2 |
0 |
0 |
Y |
0 |
15 |
1 |
4 |
0 |
2 |
0 |
2 |
0 |
0 |
0 |
A |
2021-05-16 |
| 542 |
이주희 |
여자 |
43 |
2020-12-25 00:00:00 |
143 |
인천 연수구 센트럴로 160 |
0 |
전체 |
0 |
0 |
0 |
NA |
NA |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
NA |
0 |
5 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
A |
2021-05-16 |
| 549 |
강정희 |
여자 |
57 |
2020-12-25 00:00:00 |
143 |
경기도 성남시 분당구 미금로22번길 10 |
0 |
전체 |
0 |
0 |
0 |
NA |
NA |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
NA |
0 |
5 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
A |
2021-05-16 |
| 560 |
조성욱 |
남자 |
48 |
2020-12-27 00:00:00 |
141 |
서울특별시 양천구 목동로 212 |
0 |
전체 |
1 |
74500 |
74500 |
2021-03-07 |
2021-03-07 |
71 |
1 |
74500 |
1 |
74500 |
0 |
0 |
0 |
0 |
1 |
74500 |
0 |
0 |
1 |
0 |
0 |
1 |
NA |
0 |
11 |
1 |
3 |
0 |
0 |
1 |
0 |
1 |
0 |
0 |
A |
2021-05-16 |
#파생변수 - 리드타임
data_morder <- cbind(data_morder, 리드타임 = as.numeric(( as.POSIXct(data_morder$첫주문일) - as.POSIXct(data_morder$가입일) ) / 86400) )
#파생변수 - 환공어묵 묶음
brand <- case_when(
data_morder$그룹기준브랜드 %in% c('70','35') ~ "환공어묵",
data_morder$그룹기준브랜드 %in% c('34') ~ "매드포갈릭",
data_morder$그룹기준브랜드 %in% c('44') ~ "카페리피",
data_morder$그룹기준브랜드 %in% c('3143') ~ "생어거스틴"
)
data_morder <- cbind(data_morder,brand)
###########################################################################################################################
#가입자
all_morder_ppl = data_morder[data_morder$그룹기준브랜드명 == '전체',]
dim(all_morder_ppl)[1]
## [1] 28449
#미주문자
ord_0 = data_morder[as.numeric(data_morder$주문회수_전체) == 0,]
dim(ord_0)[1]
## [1] 27152
#주문자
#1회성 주문자
ord_1 = data_morder[as.numeric(data_morder$주문회수_전체) == 1,]
ord_1 = ord_1[ord_1$그룹기준브랜드명 == '전체',]
dim(ord_1)[1]
## [1] 1087
#재구매 주문자
ord_2 = data_morder[as.numeric(data_morder$주문회수_전체) == 2,]
ord_2 = ord_2[ord_2$그룹기준브랜드명 == '전체',]
dim(ord_2)[1]
## [1] 139
#1회 이상 주문자
ord_star1 = data_morder[as.numeric(data_morder$주문회수_전체) >= 1,]
ord_star1 = ord_star1[ord_star1$그룹기준브랜드명 == '전체',]
dim(ord_star1)[1]
## [1] 1297
#재구매 이상 주문자
ord_star2 = data_morder[as.numeric(data_morder$주문회수_전체) >= 2,]
ord_star2 = ord_star2[ord_star2$그룹기준브랜드명 == '전체',]
dim(ord_star2)[1]
## [1] 210
#3회 이상 주문자
ord_3 = data_morder[as.numeric(data_morder$주문회수_전체) >= 3,]
ord_3 = ord_3[ord_3$그룹기준브랜드명 == '전체',]
dim(ord_3)[1]
## [1] 71
#브랜드 다주문자
ord_brand = data_morder[data_morder$그룹기준브랜드명 != '전체',]
ord_brand_name = ord_brand %>% select(회원일련번호, 그룹기준브랜드명) %>% group_by(회원일련번호) %>% summarise(card = paste(그룹기준브랜드명, collapse='/'))
ord_brand_count = ord_brand %>% select(회원일련번호, 그룹기준브랜드명) %>% group_by(회원일련번호) %>% count(회원일련번호)
ord_brand_ = merge(ord_brand_count, ord_brand_name, by="회원일련번호")
ord_brand2 = data_morder[data_morder$그룹기준브랜드명 == '전체',]
ord_brand_c = ord_brand2[ord_brand2$회원일련번호 %in% ord_brand_[ord_brand_$n >= 2,]$회원일련번호,]
brands <- case_when(
ord_brand_c$주문회수_전체 >=3 ~ "3회이상(충성고객)",
ord_brand_c$주문회수_전체 == 2 ~ '2회(유지고객)'
)
ord_brand_c = cbind(ord_brand_c,구매횟수=brands)
###########################################################################################################################
# 엠오더 유입 경로 - 데이터 추적 필요
# 주문을 하게끔 만드는 마케팅 액션 포인트 결정요인이 무엇인지 판별하기위한 데이터 지표 필요
# 미주문자 -> 1회주문자
# 1회주문자 -> 재구매
# 재구매 -> 매니아층
###########################################################################################################################
# 성별 / 나이 / 지역 -> 인포그래픽은 바꿀수없는 부분 . 기존 구매자 특성으로 세그먼테이션 후 -> 비슷한 특성의 신규유입자들 대상으로 마케팅 활동
# 나이 분포 차이 - 미구매자 vs 구매자
ord_00 <- cbind(ord_0, 구매횟수='0회(유입고객)')
ord_11 <- cbind(ord_1, 구매횟수='1회(참여고객)')
ord_22 <- cbind(ord_2, 구매횟수='2회(유지고객)')
ord_33 <- cbind(ord_3, 구매횟수='3회이상(충성고객)')
ord_cc <- cbind(ord_brand_c, 구매횟수='多브랜드')
ord_0123 = rbind(ord_00, ord_11, ord_22, ord_33)
#ord_0123c = rbind(ord_00, ord_11, ord_22, ord_33, ord_cc)
ord_123 = rbind(ord_11, ord_22, ord_33)
#ord_123c = rbind(ord_11, ord_22, ord_33, ord_cc)
#성별
ord_0123 %>%
count(구매횟수 = factor(구매횟수), 성별 = factor(성별)) %>%
mutate(구성비 = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = 구성비, fill = 성별, label = scales::percent(구성비))) +
geom_col(position = 'dodge') +
geom_text(position = position_dodge(width = .9), # move to center of bars
vjust = -0.5, # nudge above top of bar
size = 3) +
scale_y_continuous(labels = scales::percent) +
labs(title="MORDER 구매 단계별 성별 분포 현황 (전체)") +
theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_0123 %>%
count(구매횟수 = factor(구매횟수), 성별 = factor(성별)) %>%
mutate(구성비 = prop.table(n)) %>% gt()
| 구매횟수 |
성별 |
n |
구성비 |
| 0회(유입고객) |
남자 |
10210 |
0.35888783437 |
| 0회(유입고객) |
없음 |
450 |
0.01581777918 |
| 0회(유입고객) |
여자 |
16492 |
0.57970403178 |
| 1회(참여고객) |
남자 |
332 |
0.01167000598 |
| 1회(참여고객) |
없음 |
12 |
0.00042180744 |
| 1회(참여고객) |
여자 |
743 |
0.02611691096 |
| 2회(유지고객) |
남자 |
44 |
0.00154662730 |
| 2회(유지고객) |
없음 |
1 |
0.00003515062 |
| 2회(유지고객) |
여자 |
94 |
0.00330415832 |
| 3회이상(충성고객) |
남자 |
18 |
0.00063271117 |
| 3회이상(충성고객) |
없음 |
3 |
0.00010545186 |
| 3회이상(충성고객) |
여자 |
50 |
0.00175753102 |
#나이
a <- ggplot(ord_0123, aes(x = 나이))+ xlab("나이") + ylab("Density") + labs(title="MORDER 구매 단계별 나이 분포 현황 (전체)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_0123 %>%
group_by(구매횟수) %>%
summarise(grp.mean = mean(나이,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_0123 %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(나이,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 0회(유입고객) |
36 |
| 1회(참여고객) |
36 |
| 2회(유지고객) |
41 |
| 3회이상(충성고객) |
41 |
# 가입경과일
a <- ggplot(ord_0123, aes(x = 가입경과일))+ xlab("가입경과일") + ylab("Density") + labs(title="MORDER 구매 단계별 가입 경과일 분포 현황 (전체)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_0123 %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(가입경과일,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_0123 %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(가입경과일,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 0회(유입고객) |
86 |
| 1회(참여고객) |
84 |
| 2회(유지고객) |
96 |
| 3회이상(충성고객) |
100 |
# 결제금액 (중앙값)
a <- ggplot(ord_123, aes(x = 결제금액_전체)) + xlab("결제금액") + ylab("Density") + labs(title="MORDER 구매 단계별 결제 금액 분포 현황 (전체)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_123 %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(결제금액_전체,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_123 %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(결제금액_전체,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
19800 |
| 2회(유지고객) |
38160 |
| 3회이상(충성고객) |
64400 |
# 빌단가 ( 결제금액_전체 / 주문회수_전체 ) 중앙값
a <- ggplot(ord_123, aes(x = as.numeric(결제금액_전체) / as.numeric(주문회수_전체))) + xlab("빌단가") + ylab("Density") + labs(title="MORDER 구매 단계별 빌단가 분포 현황 (전체)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_123 %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(as.numeric(결제금액_전체) / as.numeric(주문회수_전체),na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_123 %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(as.numeric(결제금액_전체) / as.numeric(주문회수_전체),na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
19800 |
| 2회(유지고객) |
19080 |
| 3회이상(충성고객) |
17360 |
# 첫주문일 - 가입일 (최초주문시까지 경과일)
a <- ggplot(ord_123, aes(x = 리드타임)) + xlab("첫주문 리드타임") + ylab("Density") + xlab("첫주문 리드타임") + ylab("Density") + labs(title="MORDER 구매 단계별 첫주문 리드타임 분포 현황 (전체)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_123 %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(리드타임),na.rm=T)
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_123 %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(리드타임),na.rm=T) %>% gt()
| 구매횟수 |
중앙값 |
na.rm |
| 1회(참여고객) |
0 |
TRUE |
| 2회(유지고객) |
0 |
TRUE |
| 3회이상(충성고객) |
0 |
TRUE |
# 픽업 횟수
ord_123 %>%
count(구매횟수 = factor(구매횟수), 픽업주문수 = 회수_픽업) %>%
mutate(구성비 = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = 구성비, fill = 픽업주문수, label = scales::percent(구성비))) +
geom_bar(stat = 'identity', position='fill', alpha=0.8) +
geom_text(position = position_fill(vjust = .5), # move to center of bars
size = 3,color="white") +
scale_y_continuous(labels = scales::percent) +
labs(title="MORDER 구매 단계별 픽업 횟수 분포 현황 (전체)") +
theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_123 %>%
count(구매횟수 = factor(구매횟수), 픽업주문수 = 회수_픽업) %>%
mutate(구성비 = prop.table(n)) %>% gt()
| 구매횟수 |
픽업주문수 |
n |
구성비 |
| 1회(참여고객) |
0 |
880 |
0.67848882 |
| 1회(참여고객) |
1 |
207 |
0.15959907 |
| 2회(유지고객) |
0 |
106 |
0.08172706 |
| 2회(유지고객) |
1 |
9 |
0.00693909 |
| 2회(유지고객) |
2 |
24 |
0.01850424 |
| 3회이상(충성고객) |
0 |
37 |
0.02852737 |
| 3회이상(충성고객) |
1 |
6 |
0.00462606 |
| 3회이상(충성고객) |
2 |
5 |
0.00385505 |
| 3회이상(충성고객) |
3 |
11 |
0.00848111 |
| 3회이상(충성고객) |
4 |
7 |
0.00539707 |
| 3회이상(충성고객) |
5 |
2 |
0.00154202 |
| 3회이상(충성고객) |
6 |
1 |
0.00077101 |
| 3회이상(충성고객) |
7 |
1 |
0.00077101 |
| 3회이상(충성고객) |
12 |
1 |
0.00077101 |
# 배달 횟수
ord_123 %>%
count(구매횟수 = factor(구매횟수), 배달주문수 = 회수_배달) %>%
mutate(구성비 = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = 구성비, fill = 배달주문수, label = scales::percent(구성비))) +
geom_bar(stat = 'identity', position='fill', alpha=0.8) +
geom_text(position = position_fill(vjust = .5), # move to center of bars
size = 3,color="white") +
scale_y_continuous(labels = scales::percent) +
labs(title="MORDER 구매 단계별 배달 횟수 분포 현황 (전체)") +
theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_123 %>%
count(구매횟수 = factor(구매횟수), 배달주문수 = 회수_배달) %>%
mutate(구성비 = prop.table(n)) %>% gt()
| 구매횟수 |
배달주문수 |
n |
구성비 |
| 1회(참여고객) |
0 |
811 |
0.62528913 |
| 1회(참여고객) |
1 |
276 |
0.21279877 |
| 2회(유지고객) |
0 |
80 |
0.06168080 |
| 2회(유지고객) |
1 |
6 |
0.00462606 |
| 2회(유지고객) |
2 |
53 |
0.04086353 |
| 3회이상(충성고객) |
0 |
45 |
0.03469545 |
| 3회이상(충성고객) |
1 |
3 |
0.00231303 |
| 3회이상(충성고객) |
2 |
3 |
0.00231303 |
| 3회이상(충성고객) |
3 |
16 |
0.01233616 |
| 3회이상(충성고객) |
4 |
2 |
0.00154202 |
| 3회이상(충성고객) |
5 |
1 |
0.00077101 |
| 3회이상(충성고객) |
7 |
1 |
0.00077101 |
# 테이블 횟수
ord_123 %>%
count(구매횟수 = factor(구매횟수), 테이블주문수 = 회수_테이블) %>%
mutate(구성비 = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = 구성비, fill = 테이블주문수, label = scales::percent(구성비))) +
geom_bar(stat = 'identity', position='fill', alpha=0.8) +
geom_text(position = position_fill(vjust = .5), # move to center of bars
size = 3,color="white") +
scale_y_continuous(labels = scales::percent) +
labs(title="MORDER 구매 단계별 테이블 주문 횟수 분포 현황 (전체)") +
theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_123 %>%
count(구매횟수 = factor(구매횟수), 테이블주문수 = 회수_테이블) %>%
mutate(구성비 = prop.table(n)) %>% gt()
| 구매횟수 |
테이블주문수 |
n |
구성비 |
| 1회(참여고객) |
0 |
483 |
0.37239784 |
| 1회(참여고객) |
1 |
604 |
0.46569005 |
| 2회(유지고객) |
0 |
82 |
0.06322282 |
| 2회(유지고객) |
1 |
5 |
0.00385505 |
| 2회(유지고객) |
2 |
52 |
0.04009252 |
| 3회이상(충성고객) |
0 |
43 |
0.03315343 |
| 3회이상(충성고객) |
1 |
5 |
0.00385505 |
| 3회이상(충성고객) |
3 |
13 |
0.01002313 |
| 3회이상(충성고객) |
4 |
4 |
0.00308404 |
| 3회이상(충성고객) |
5 |
3 |
0.00231303 |
| 3회이상(충성고객) |
7 |
2 |
0.00154202 |
| 3회이상(충성고객) |
17 |
1 |
0.00077101 |
# 엠페이등록수
ord_0123 %>%
count(구매횟수 = factor(구매횟수), 엠페이등록수 = 엠페이등록) %>%
mutate(구성비 = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = 구성비 , fill = 엠페이등록수, label = scales::percent(구성비))) +
geom_bar(stat = 'identity', position='fill', alpha=0.8) +
geom_text(position = position_fill(vjust = .5), # move to center of bars
size = 3,color="white") +
scale_y_continuous(labels = scales::percent)+
labs(title="MORDER 구매 단계별 엠페이 등록 횟수 분포 현황 (전체)") +
theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_0123 %>%
count(구매횟수 = factor(구매횟수), 엠페이등록수 = 엠페이등록) %>%
mutate(구성비 = prop.table(n)) %>% gt()
| 구매횟수 |
엠페이등록수 |
n |
구성비 |
| 0회(유입고객) |
Y |
35 |
0.0012302717 |
| 0회(유입고객) |
NA |
27117 |
0.9531793736 |
| 1회(참여고객) |
Y |
15 |
0.0005272593 |
| 1회(참여고객) |
NA |
1072 |
0.0376814651 |
| 2회(유지고객) |
Y |
6 |
0.0002109037 |
| 2회(유지고객) |
NA |
133 |
0.0046750325 |
| 3회이상(충성고객) |
Y |
4 |
0.0001406025 |
| 3회이상(충성고객) |
NA |
67 |
0.0023550916 |
# 스탬프적립수
ord_0123 %>%
count(구매횟수 = factor(구매횟수), 스탬프적립수 = 스탬프적립) %>%
mutate(구성비 = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = 구성비 , fill = 스탬프적립수, label = scales::percent(구성비))) +
geom_bar(stat = 'identity', position='fill', alpha=0.8) +
geom_text(position = position_fill(vjust = .5), # move to center of bars
size = 3,color="white")+
scale_y_continuous(labels = scales::percent)+
labs(title="MORDER 구매 단계별 스탬프 적립 횟수 분포 현황 (전체)") +
theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_0123 %>%
count(구매횟수 = factor(구매횟수), 스탬프적립수 = 스탬프적립) %>%
mutate(구성비 = prop.table(n)) %>% gt()
| 구매횟수 |
스탬프적립수 |
n |
구성비 |
| 0회(유입고객) |
0 |
27152 |
0.95440964533 |
| 1회(참여고객) |
0 |
1045 |
0.03673239833 |
| 1회(참여고객) |
1 |
42 |
0.00147632606 |
| 2회(유지고객) |
0 |
121 |
0.00425322507 |
| 2회(유지고객) |
1 |
18 |
0.00063271117 |
| 3회이상(충성고객) |
0 |
62 |
0.00217933847 |
| 3회이상(충성고객) |
1 |
3 |
0.00010545186 |
| 3회이상(충성고객) |
2 |
5 |
0.00017575310 |
| 3회이상(충성고객) |
3 |
1 |
0.00003515062 |
# 온라인 쿠폰발급수
a <- ggplot(ord_0123, aes(x = 온라인쿠폰발급)) + xlab("온라인쿠폰발급수") + ylab("Density") + labs(title="MORDER 구매 단계별 온라인 쿠폰 발급 수 분포 현황 (전체)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_0123 %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(온라인쿠폰발급,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_0123 %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(온라인쿠폰발급,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 0회(유입고객) |
2 |
| 1회(참여고객) |
2 |
| 2회(유지고객) |
4 |
| 3회이상(충성고객) |
6 |
# 온라인 쿠폰사용수
a <- ggplot(ord_123, aes(x = 온라인쿠폰사용)) + xlab("온라인쿠폰사용수") + ylab("Density") + scale_x_continuous(breaks=seq(0, 1000, 1)) + labs(title="MORDER 구매 단계별 온라인 쿠폰 사용 수 분포 현황 (전체)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_123 %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(온라인쿠폰사용,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_123 %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(온라인쿠폰사용,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
1 |
| 2회(유지고객) |
2 |
| 3회이상(충성고객) |
2 |
# 온라인 쿠폰사용률
a <- ggplot(ord_123, aes(x = as.numeric(온라인쿠폰사용)/as.numeric(온라인쿠폰발급))) + xlab("온라인쿠폰사용률") + ylab("Density") + labs(title="MORDER 구매 단계별 온라인 쿠폰 사용률 분포 현황 (전체) \n (* 사용률 = 사용수/발급수)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_123 %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(as.numeric(온라인쿠폰사용)/as.numeric(온라인쿠폰발급),na.rm=T ))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_123 %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(as.numeric(온라인쿠폰사용)/as.numeric(온라인쿠폰발급),na.rm=T )) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
0.5000000 |
| 2회(유지고객) |
0.3333333 |
| 3회이상(충성고객) |
0.4000000 |
# 오프라인 쿠폰발급수
a <- ggplot(ord_0123, aes(x = 오프라인쿠폰발급))+ xlab("오프라인쿠폰발급수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 오프라인 쿠폰 발급 수 분포 현황 (전체)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_0123 %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(오프라인쿠폰발급,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_0123 %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(오프라인쿠폰발급,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 0회(유입고객) |
3 |
| 1회(참여고객) |
1 |
| 2회(유지고객) |
1 |
| 3회이상(충성고객) |
2 |
# 오프라인 쿠폰사용수
a <- ggplot(ord_0123, aes(x = 오프라인쿠폰사용)) + xlab("오프라인쿠폰사용수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 오프라인 쿠폰 사용 수 분포 현황 (전체)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_0123 %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(오프라인쿠폰사용,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_0123 %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(오프라인쿠폰사용,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 0회(유입고객) |
1 |
| 1회(참여고객) |
0 |
| 2회(유지고객) |
0 |
| 3회이상(충성고객) |
0 |
# 오프라인 쿠폰사용률
a <- ggplot(ord_0123, aes(x = as.numeric(오프라인쿠폰사용)/as.numeric(오프라인쿠폰발급))) + xlab("오프라인쿠폰사용률") + ylab("Density") + labs(title="MORDER 구매 단계별 오프라인 쿠폰 사용률 분포 현황 (전체) \n (* 사용률 = 사용수/발급수)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_0123 %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(as.numeric(오프라인쿠폰사용)/as.numeric(오프라인쿠폰발급), na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_0123 %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(as.numeric(오프라인쿠폰사용)/as.numeric(오프라인쿠폰발급), na.rm=T))%>%gt()
| 구매횟수 |
중앙값 |
| 0회(유입고객) |
0.25 |
| 1회(참여고객) |
0.00 |
| 2회(유지고객) |
0.00 |
| 3회이상(충성고객) |
0.00 |
# 주중 / 주말 - 점심 / 저녁 / 스윙 /기타시간
# 주중
a <- ggplot(ord_123, aes(x = 주중)) + xlab("주중주문수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 주중 주문 수 분포 현황 (전체) ") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_123 %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(주중,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_123 %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(주중,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
1 |
| 2회(유지고객) |
1 |
| 3회이상(충성고객) |
2 |
#주말
a <- ggplot(ord_123, aes(x = 주말)) + xlab("주말주문수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 주말 주문 수 분포 현황 (전체) ") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_123 %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(주말,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_123 %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(주말,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
0 |
| 2회(유지고객) |
1 |
| 3회이상(충성고객) |
1 |
#점심
a <- ggplot(ord_123, aes(x = 점심)) + xlab("점심주문수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 점심 시간대 주문 수 분포 현황 (전체) ") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_123 %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(점심,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_123 %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(점심,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
0 |
| 2회(유지고객) |
0 |
| 3회이상(충성고객) |
2 |
#저녁
a <- ggplot(ord_123, aes(x = 저녁)) + xlab("저녁주문수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 저녁 시간대 주문 수 분포 현황 (전체) ") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_123 %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(저녁,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_123 %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(저녁,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
0 |
| 2회(유지고객) |
0 |
| 3회이상(충성고객) |
0 |
#스윙
a <- ggplot(ord_123, aes(x = 스윙)) + xlab("스윙주문수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 스윙 시간대 주문 수 분포 현황 (전체) ") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_123 %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(스윙,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_123 %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(스윙,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
0 |
| 2회(유지고객) |
0 |
| 3회이상(충성고객) |
1 |
#################################################################################################################################
# 브랜드별 통계
# 1회 구매자
ord_1b_raw <- data_morder[data_morder$회원일련번호 %in% ord_1$회원일련번호,]
ord_1b_raw <- ord_1b_raw[ord_1b_raw$그룹기준브랜드명!='전체',]
ord_1b_raw <- cbind(ord_1b_raw, 구매횟수='1회(참여고객)')
ord_2b_raw <- data_morder[data_morder$회원일련번호 %in% ord_2$회원일련번호,]
ord_2b_raw <- ord_2b_raw[ord_2b_raw$그룹기준브랜드명!='전체',]
ord_2b_raw <- cbind(ord_2b_raw, 구매횟수='2회(유지고객)')
ord_3b_raw <- data_morder[data_morder$회원일련번호 %in% ord_3$회원일련번호,]
ord_3b_raw <- ord_3b_raw[ord_3b_raw$그룹기준브랜드명!='전체',]
ord_3b_raw <- cbind(ord_3b_raw, 구매횟수='3회이상(충성고객)')
ord_bs_raw <- rbind(ord_1b_raw,ord_2b_raw,ord_3b_raw)
# 구매횟수별 구성비(count)
# ord_bs_raw %>%
# count(구매횟수 = factor(구매횟수)) %>%
# mutate(pct = prop.table(n)) %>%
# ggplot(aes(x = 구매횟수, y = n, fill = 구매횟수, label = n )) +
# geom_col(position = 'dodge') +
# geom_text(position = position_dodge(width = .9), # move to center of bars
# vjust = -0.5, # nudge above top of bar
# size = 4) + labs(title="MORDER 구매 단계별 주문 수 분포 현황 (전체) ") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
# ord_bs_raw %>%
# count(구매횟수 = factor(구매횟수)) %>%
# mutate(pct = prop.table(n)) %>% gt()
# 구매횟수별 구성비(percent)
ord_bs_raw %>%
count(구매횟수 = factor(구매횟수)) %>%
mutate(pct = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = n, fill = 구매횟수, label = scales::percent(pct) )) +
geom_col(position = 'dodge') +
geom_text(position = position_dodge(width = .9), # move to center of bars
vjust = -0.5, # nudge above top of bar
size = 4) +
scale_y_continuous(labels = scales::percent) + labs(title="MORDER 구매 단계별 주문 수 구성비 현황 (전체) ") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_bs_raw %>%
count(구매횟수 = factor(구매횟수)) %>%
mutate(pct = prop.table(n)) %>% gt()
| 구매횟수 |
n |
pct |
| 1회(참여고객) |
1087 |
0.82787510 |
| 2회(유지고객) |
143 |
0.10891089 |
| 3회이상(충성고객) |
83 |
0.06321401 |
# 브랜드별 구성비(count)
# ord_bs_raw %>%
# count(구매횟수 = factor(구매횟수), 브랜드 = factor(그룹기준브랜드명)) %>%
# mutate(pct = prop.table(n)) %>%
# ggplot(aes(x = 구매횟수, y = n, fill = 브랜드, label = n)) +
# geom_col(position = 'dodge') +
# geom_text(position = position_dodge(width = .9), # move to center of bars
# vjust = -0.5, # nudge above top of bar
# size = 3) + labs(title="MORDER 구매 단계별 브랜드 수 분포 현황 (전체) ") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
# ord_bs_raw %>%
# count(구매횟수 = factor(구매횟수), 브랜드 = factor(그룹기준브랜드명)) %>%
# mutate(pct = prop.table(n)) %>% gt()
# 브랜드별 구성비(percent)
ord_bs_raw %>%
count(구매횟수 = factor(구매횟수), 브랜드 = factor(brand)) %>%
mutate(pct = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = pct, fill = 브랜드, label = scales::percent(pct))) +
geom_col(position = 'dodge') +
geom_text(position = position_dodge(width = .9), # move to center of bars
vjust = -0.5, # nudge above top of bar
size = 3) +
scale_y_continuous(labels = scales::percent)+ labs(title="MORDER 구매 단계별 주문 수 구성비 현황 (전체) ") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_bs_raw %>%
count(구매횟수 = factor(구매횟수), 브랜드 = factor(brand)) %>%
mutate(pct = prop.table(n)) %>% gt()
| 구매횟수 |
브랜드 |
n |
pct |
| 1회(참여고객) |
매드포갈릭 |
373 |
0.2840822544 |
| 1회(참여고객) |
생어거스틴 |
1 |
0.0007616146 |
| 1회(참여고객) |
카페리피 |
352 |
0.2680883473 |
| 1회(참여고객) |
환공어묵 |
361 |
0.2749428789 |
| 2회(유지고객) |
매드포갈릭 |
73 |
0.0555978675 |
| 2회(유지고객) |
카페리피 |
49 |
0.0373191165 |
| 2회(유지고객) |
환공어묵 |
21 |
0.0159939071 |
| 3회이상(충성고객) |
매드포갈릭 |
31 |
0.0236100533 |
| 3회이상(충성고객) |
생어거스틴 |
1 |
0.0007616146 |
| 3회이상(충성고객) |
카페리피 |
31 |
0.0236100533 |
| 3회이상(충성고객) |
환공어묵 |
20 |
0.0152322925 |
#############################################################################################
#매드포갈릭
#성별
ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
count(구매횟수 = factor(구매횟수), 성별 = factor(성별)) %>%
mutate(구성비 = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = 구성비, fill = 성별, label = scales::percent(구성비))) +
geom_col(position = 'dodge') +
geom_text(position = position_dodge(width = .9), # move to center of bars
vjust = -0.5, # nudge above top of bar
size = 3) +
scale_y_continuous(labels = scales::percent) +
labs(title="MORDER 구매 단계별 성별 분포 현황 (매드포갈릭)") +
theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
count(구매횟수 = factor(구매횟수), 성별 = factor(성별)) %>%
mutate(구성비 = prop.table(n)) %>% gt()
| 구매횟수 |
성별 |
n |
구성비 |
| 1회(참여고객) |
남자 |
125 |
0.262054507 |
| 1회(참여고객) |
없음 |
2 |
0.004192872 |
| 1회(참여고객) |
여자 |
246 |
0.515723270 |
| 2회(유지고객) |
남자 |
20 |
0.041928721 |
| 2회(유지고객) |
여자 |
53 |
0.111111111 |
| 3회이상(충성고객) |
남자 |
12 |
0.025157233 |
| 3회이상(충성고객) |
없음 |
1 |
0.002096436 |
| 3회이상(충성고객) |
여자 |
18 |
0.037735849 |
#나이
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',], aes(x = 나이))+ xlab("나이") + ylab("Density") + labs(title="MORDER 구매 단계별 나이 분포 현황 (매드포갈릭)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = mean(나이,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(나이,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
40 |
| 2회(유지고객) |
43 |
| 3회이상(충성고객) |
43 |
# 가입경과일
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',], aes(x = 가입경과일))+ xlab("가입경과일") + ylab("Density") + labs(title="MORDER 구매 단계별 가입 경과일 분포 현황 (매드포갈릭)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(가입경과일,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(가입경과일,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
89 |
| 2회(유지고객) |
93 |
| 3회이상(충성고객) |
93 |
# 결제금액 (중앙값)
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',], aes(x = 결제금액_전체)) + xlab("결제금액") + ylab("Density") + labs(title="MORDER 구매 단계별 결제 금액 분포 현황 (매드포갈릭)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(결제금액_전체,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(결제금액_전체,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
34200 |
| 2회(유지고객) |
52900 |
| 3회이상(충성고객) |
84500 |
# 빌단가 ( 결제금액_전체 / 주문회수_전체 ) 중앙값
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',], aes(x = as.numeric(결제금액_전체) / as.numeric(주문회수_전체))) + xlab("빌단가") + ylab("Density") + labs(title="MORDER 구매 단계별 빌단가 분포 현황 (매드포갈릭)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(as.numeric(결제금액_전체) / as.numeric(주문회수_전체),na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(as.numeric(결제금액_전체) / as.numeric(주문회수_전체),na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
34200.00 |
| 2회(유지고객) |
26500.00 |
| 3회이상(충성고객) |
21866.67 |
# 첫주문일 - 가입일 (최초주문시까지 경과일)
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',], aes(x = 리드타임)) + xlab("첫주문 리드타임") + ylab("Density") + xlab("빌단가") + ylab("Density") + labs(title="MORDER 구매 단계별 첫주문 리드타임 분포 현황 (매드포갈릭)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(리드타임),na.rm=T)
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(리드타임),na.rm=T) %>% gt()
| 구매횟수 |
중앙값 |
na.rm |
| 1회(참여고객) |
1 |
TRUE |
| 2회(유지고객) |
3 |
TRUE |
| 3회이상(충성고객) |
9 |
TRUE |
# 픽업 횟수
ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
count(구매횟수 = factor(구매횟수), 픽업주문수 = 회수_픽업) %>%
mutate(구성비 = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = 구성비, fill = 픽업주문수, label = scales::percent(구성비))) +
geom_bar(stat = 'identity', position='fill', alpha=0.8) +
geom_text(position = position_fill(vjust = .5), # move to center of bars
size = 3,color="white") +
scale_y_continuous(labels = scales::percent) +
labs(title="MORDER 구매 단계별 픽업 횟수 분포 현황 (매드포갈릭)") +
theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
count(구매횟수 = factor(구매횟수), 픽업주문수 = 회수_픽업) %>%
mutate(구성비 = prop.table(n)) %>% gt()
| 구매횟수 |
픽업주문수 |
n |
구성비 |
| 1회(참여고객) |
0 |
270 |
0.566037736 |
| 1회(참여고객) |
1 |
103 |
0.215932914 |
| 2회(유지고객) |
0 |
54 |
0.113207547 |
| 2회(유지고객) |
1 |
6 |
0.012578616 |
| 2회(유지고객) |
2 |
13 |
0.027253669 |
| 3회이상(충성고객) |
0 |
19 |
0.039832285 |
| 3회이상(충성고객) |
1 |
3 |
0.006289308 |
| 3회이상(충성고객) |
2 |
3 |
0.006289308 |
| 3회이상(충성고객) |
3 |
2 |
0.004192872 |
| 3회이상(충성고객) |
4 |
3 |
0.006289308 |
| 3회이상(충성고객) |
5 |
1 |
0.002096436 |
# 배달 횟수
ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
count(구매횟수 = factor(구매횟수), 배달주문수 = 회수_배달) %>%
mutate(구성비 = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = 구성비, fill = 배달주문수, label = scales::percent(구성비))) +
geom_bar(stat = 'identity', position='fill', alpha=0.8) +
geom_text(position = position_fill(vjust = .5), # move to center of bars
size = 3,color="white") +
scale_y_continuous(labels = scales::percent) +
labs(title="MORDER 구매 단계별 배달 횟수 분포 현황 (매드포갈릭)") +
theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
count(구매횟수 = factor(구매횟수), 배달주문수 = 회수_배달) %>%
mutate(구성비 = prop.table(n)) %>% gt()
| 구매횟수 |
배달주문수 |
n |
구성비 |
| 1회(참여고객) |
0 |
103 |
0.215932914 |
| 1회(참여고객) |
1 |
270 |
0.566037736 |
| 2회(유지고객) |
0 |
14 |
0.029350105 |
| 2회(유지고객) |
1 |
6 |
0.012578616 |
| 2회(유지고객) |
2 |
53 |
0.111111111 |
| 3회이상(충성고객) |
0 |
9 |
0.018867925 |
| 3회이상(충성고객) |
1 |
1 |
0.002096436 |
| 3회이상(충성고객) |
2 |
2 |
0.004192872 |
| 3회이상(충성고객) |
3 |
15 |
0.031446541 |
| 3회이상(충성고객) |
4 |
2 |
0.004192872 |
| 3회이상(충성고객) |
5 |
1 |
0.002096436 |
| 3회이상(충성고객) |
6 |
1 |
0.002096436 |
# 테이블 횟수
ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
count(구매횟수 = factor(구매횟수), 테이블주문수 = 회수_테이블) %>%
mutate(구성비 = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = 구성비, fill = 테이블주문수, label = scales::percent(구성비))) +
geom_bar(stat = 'identity', position='fill', alpha=0.8) +
geom_text(position = position_fill(vjust = .5), # move to center of bars
size = 3,color="white") +
scale_y_continuous(labels = scales::percent) +
labs(title="MORDER 구매 단계별 테이블 주문 횟수 분포 현황 (매드포갈릭)") +
theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
count(구매횟수 = factor(구매횟수), 테이블주문수 = 회수_테이블) %>%
mutate(구성비 = prop.table(n)) %>% gt()
| 구매횟수 |
테이블주문수 |
n |
구성비 |
| 1회(참여고객) |
0 |
373 |
0.78197065 |
| 2회(유지고객) |
0 |
73 |
0.15303983 |
| 3회이상(충성고객) |
0 |
31 |
0.06498952 |
# 엠페이등록수
ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
count(구매횟수 = factor(구매횟수), 엠페이등록수 = 엠페이등록) %>%
mutate(구성비 = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = 구성비 , fill = 엠페이등록수, label = scales::percent(구성비))) +
geom_bar(stat = 'identity', position='fill', alpha=0.8) +
geom_text(position = position_fill(vjust = .5), # move to center of bars
size = 3,color="white") +
scale_y_continuous(labels = scales::percent)+
labs(title="MORDER 구매 단계별 엠페이 등록 횟수 분포 현황 (매드포갈릭)") +
theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
count(구매횟수 = factor(구매횟수), 엠페이등록수 = 엠페이등록) %>%
mutate(구성비 = prop.table(n)) %>% gt()
| 구매횟수 |
엠페이등록수 |
n |
구성비 |
| 1회(참여고객) |
Y |
4 |
0.008385744 |
| 1회(참여고객) |
NA |
369 |
0.773584906 |
| 2회(유지고객) |
Y |
4 |
0.008385744 |
| 2회(유지고객) |
NA |
69 |
0.144654088 |
| 3회이상(충성고객) |
Y |
2 |
0.004192872 |
| 3회이상(충성고객) |
NA |
29 |
0.060796646 |
# 스탬프적립수
ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
count(구매횟수 = factor(구매횟수), 스탬프적립수 = 스탬프적립) %>%
mutate(구성비 = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = 구성비 , fill = 스탬프적립수, label = scales::percent(구성비))) +
geom_bar(stat = 'identity', position='fill', alpha=0.8) +
geom_text(position = position_fill(vjust = .5), # move to center of bars
size = 3,color="white")+
scale_y_continuous(labels = scales::percent)+
labs(title="MORDER 구매 단계별 스탬프 적립 횟수 분포 현황 (매드포갈릭)") +
theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
count(구매횟수 = factor(구매횟수), 스탬프적립수 = 스탬프적립) %>%
mutate(구성비 = prop.table(n)) %>% gt()
| 구매횟수 |
스탬프적립수 |
n |
구성비 |
| 1회(참여고객) |
0 |
331 |
0.693920335 |
| 1회(참여고객) |
1 |
42 |
0.088050314 |
| 2회(유지고객) |
0 |
55 |
0.115303983 |
| 2회(유지고객) |
1 |
18 |
0.037735849 |
| 3회이상(충성고객) |
0 |
22 |
0.046121593 |
| 3회이상(충성고객) |
1 |
3 |
0.006289308 |
| 3회이상(충성고객) |
2 |
5 |
0.010482180 |
| 3회이상(충성고객) |
3 |
1 |
0.002096436 |
# 온라인 쿠폰발급수
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',], aes(x = 온라인쿠폰발급)) + xlab("온라인쿠폰발급수") + ylab("Density") + labs(title="MORDER 구매 단계별 온라인 쿠폰 발급 수 분포 현황 (매드포갈릭)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(온라인쿠폰발급,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(온라인쿠폰발급,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
4 |
| 2회(유지고객) |
5 |
| 3회이상(충성고객) |
8 |
# 온라인 쿠폰사용수
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',], aes(x = 온라인쿠폰사용)) + xlab("온라인쿠폰사용수") + ylab("Density") + scale_x_continuous(breaks=seq(0, 1000, 1)) + labs(title="MORDER 구매 단계별 온라인 쿠폰 사용 수 분포 현황 (매드포갈릭)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(온라인쿠폰사용,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(온라인쿠폰사용,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
1 |
| 2회(유지고객) |
2 |
| 3회이상(충성고객) |
3 |
# 온라인 쿠폰사용률
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',], aes(x = as.numeric(온라인쿠폰사용)/as.numeric(온라인쿠폰발급))) + xlab("온라인쿠폰사용률") + ylab("Density") + labs(title="MORDER 구매 단계별 온라인 쿠폰 사용률 분포 현황 (매드포갈릭) \n (* 사용률 = 사용수/발급수)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(as.numeric(온라인쿠폰사용)/as.numeric(온라인쿠폰발급),na.rm=T ))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(as.numeric(온라인쿠폰사용)/as.numeric(온라인쿠폰발급),na.rm=T )) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
0.25 |
| 2회(유지고객) |
0.40 |
| 3회이상(충성고객) |
0.50 |
# 오프라인 쿠폰발급수
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',], aes(x = 오프라인쿠폰발급))+ xlab("오프라인쿠폰발급수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 오프라인 쿠폰 발급 수 분포 현황 (매드포갈릭)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(오프라인쿠폰발급,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(오프라인쿠폰발급,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
4 |
| 2회(유지고객) |
4 |
| 3회이상(충성고객) |
4 |
# 오프라인 쿠폰사용수
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',], aes(x = 오프라인쿠폰사용)) + xlab("오프라인쿠폰사용수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 오프라인 쿠폰 사용 수 분포 현황 (매드포갈릭)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(오프라인쿠폰사용,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(오프라인쿠폰사용,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
0 |
| 2회(유지고객) |
0 |
| 3회이상(충성고객) |
1 |
# 오프라인 쿠폰사용률
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',], aes(x = as.numeric(오프라인쿠폰사용)/as.numeric(오프라인쿠폰발급))) + xlab("오프라인쿠폰사용률") + ylab("Density") + labs(title="MORDER 구매 단계별 오프라인 쿠폰 사용률 분포 현황 (매드포갈릭) \n (* 사용률 = 사용수/발급수)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(as.numeric(오프라인쿠폰사용)/as.numeric(오프라인쿠폰발급), na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(as.numeric(오프라인쿠폰사용)/as.numeric(오프라인쿠폰발급), na.rm=T))%>%gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
0.00 |
| 2회(유지고객) |
0.00 |
| 3회이상(충성고객) |
0.25 |
# 주중 / 주말 - 점심 / 저녁 / 스윙 /기타시간
# 주중
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',], aes(x = 주중)) + xlab("주중주문수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 주중 주문 수 분포 현황 (매드포갈릭) ") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(주중,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(주중,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
1 |
| 2회(유지고객) |
1 |
| 3회이상(충성고객) |
2 |
#주말
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',], aes(x = 주말)) + xlab("주말주문수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 주말 주문 수 분포 현황 (매드포갈릭) ") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(주말,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(주말,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
0 |
| 2회(유지고객) |
1 |
| 3회이상(충성고객) |
1 |
#점심
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',], aes(x = 점심)) + xlab("점심주문수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 점심 시간대 주문 수 분포 현황 (매드포갈릭) ") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(점심,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(점심,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
0 |
| 2회(유지고객) |
0 |
| 3회이상(충성고객) |
1 |
#저녁
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',], aes(x = 저녁)) + xlab("저녁주문수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 저녁 시간대 주문 수 분포 현황 (매드포갈릭) ") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(저녁,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(저녁,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
0 |
| 2회(유지고객) |
0 |
| 3회이상(충성고객) |
0 |
#스윙
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',], aes(x = 스윙)) + xlab("스윙주문수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 스윙 시간대 주문 수 분포 현황 (매드포갈릭) ") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(스윙,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='매드포갈릭 ',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(스윙,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
0 |
| 2회(유지고객) |
1 |
| 3회이상(충성고객) |
1 |
###################################################################################################################################
# 카페리피
#성별
ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
count(구매횟수 = factor(구매횟수), 성별 = factor(성별)) %>%
mutate(구성비 = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = 구성비, fill = 성별, label = scales::percent(구성비))) +
geom_col(position = 'dodge') +
geom_text(position = position_dodge(width = .9), # move to center of bars
vjust = -0.5, # nudge above top of bar
size = 3) +
scale_y_continuous(labels = scales::percent) +
labs(title="MORDER 구매 단계별 성별 분포 현황 (카페리피)") +
theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
count(구매횟수 = factor(구매횟수), 성별 = factor(성별)) %>%
mutate(구성비 = prop.table(n)) %>% gt()
| 구매횟수 |
성별 |
n |
구성비 |
| 1회(참여고객) |
남자 |
95 |
0.219907407 |
| 1회(참여고객) |
없음 |
7 |
0.016203704 |
| 1회(참여고객) |
여자 |
250 |
0.578703704 |
| 2회(유지고객) |
남자 |
17 |
0.039351852 |
| 2회(유지고객) |
없음 |
1 |
0.002314815 |
| 2회(유지고객) |
여자 |
31 |
0.071759259 |
| 3회이상(충성고객) |
남자 |
6 |
0.013888889 |
| 3회이상(충성고객) |
없음 |
3 |
0.006944444 |
| 3회이상(충성고객) |
여자 |
22 |
0.050925926 |
#나이
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',], aes(x = 나이))+ xlab("나이") + ylab("Density") + labs(title="MORDER 구매 단계별 나이 분포 현황 (카페리피)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = mean(나이,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(나이,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
34 |
| 2회(유지고객) |
38 |
| 3회이상(충성고객) |
39 |
# 가입경과일
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',], aes(x = 가입경과일))+ xlab("가입경과일") + ylab("Density") + labs(title="MORDER 구매 단계별 가입 경과일 분포 현황 (카페리피)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(가입경과일,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(가입경과일,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
79.5 |
| 2회(유지고객) |
158.0 |
| 3회이상(충성고객) |
158.0 |
# 결제금액 (중앙값)
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',], aes(x = 결제금액_전체)) + xlab("결제금액") + ylab("Density") + labs(title="MORDER 구매 단계별 결제 금액 분포 현황 (카페리피)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(결제금액_전체,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(결제금액_전체,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
17550 |
| 2회(유지고객) |
27120 |
| 3회이상(충성고객) |
50820 |
# 빌단가 ( 결제금액_전체 / 주문회수_전체 ) 중앙값
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',], aes(x = as.numeric(결제금액_전체) / as.numeric(주문회수_전체))) + xlab("빌단가") + ylab("Density") + labs(title="MORDER 구매 단계별 빌단가 분포 현황 (카페리피)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(as.numeric(결제금액_전체) / as.numeric(주문회수_전체),na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(as.numeric(결제금액_전체) / as.numeric(주문회수_전체),na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
17550 |
| 2회(유지고객) |
13600 |
| 3회이상(충성고객) |
15160 |
# 첫주문일 - 가입일 (최초주문시까지 경과일)
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',], aes(x = 리드타임)) + xlab("첫주문 리드타임") + ylab("Density") + xlab("빌단가") + ylab("Density") + labs(title="MORDER 구매 단계별 첫주문 리드타임 분포 현황 (카페리피)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(리드타임),na.rm=T)
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(리드타임),na.rm=T) %>% gt()
| 구매횟수 |
중앙값 |
na.rm |
| 1회(참여고객) |
0 |
TRUE |
| 2회(유지고객) |
0 |
TRUE |
| 3회이상(충성고객) |
0 |
TRUE |
# 픽업 횟수
ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
count(구매횟수 = factor(구매횟수), 픽업주문수 = 회수_픽업) %>%
mutate(구성비 = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = 구성비, fill = 픽업주문수, label = scales::percent(구성비))) +
geom_bar(stat = 'identity', position='fill', alpha=0.8) +
geom_text(position = position_fill(vjust = .5), # move to center of bars
size = 3,color="white") +
scale_y_continuous(labels = scales::percent) +
labs(title="MORDER 구매 단계별 픽업 횟수 분포 현황 (카페리피)") +
theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
count(구매횟수 = factor(구매횟수), 픽업주문수 = 회수_픽업) %>%
mutate(구성비 = prop.table(n)) %>% gt()
| 구매횟수 |
픽업주문수 |
n |
구성비 |
| 1회(참여고객) |
0 |
331 |
0.766203704 |
| 1회(참여고객) |
1 |
21 |
0.048611111 |
| 2회(유지고객) |
0 |
43 |
0.099537037 |
| 2회(유지고객) |
1 |
4 |
0.009259259 |
| 2회(유지고객) |
2 |
2 |
0.004629630 |
| 3회이상(충성고객) |
0 |
19 |
0.043981481 |
| 3회이상(충성고객) |
1 |
8 |
0.018518519 |
| 3회이상(충성고객) |
2 |
2 |
0.004629630 |
| 3회이상(충성고객) |
3 |
1 |
0.002314815 |
| 3회이상(충성고객) |
4 |
1 |
0.002314815 |
# 배달 횟수
ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
count(구매횟수 = factor(구매횟수), 배달주문수 = 회수_배달) %>%
mutate(구성비 = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = 구성비, fill = 배달주문수, label = scales::percent(구성비))) +
geom_bar(stat = 'identity', position='fill', alpha=0.8) +
geom_text(position = position_fill(vjust = .5), # move to center of bars
size = 3,color="white") +
scale_y_continuous(labels = scales::percent) +
labs(title="MORDER 구매 단계별 배달 횟수 분포 현황 (카페리피)") +
theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
count(구매횟수 = factor(구매횟수), 배달주문수 = 회수_배달) %>%
mutate(구성비 = prop.table(n)) %>% gt()
| 구매횟수 |
배달주문수 |
n |
구성비 |
| 1회(참여고객) |
0 |
347 |
0.803240741 |
| 1회(참여고객) |
1 |
5 |
0.011574074 |
| 2회(유지고객) |
0 |
49 |
0.113425926 |
| 3회이상(충성고객) |
0 |
26 |
0.060185185 |
| 3회이상(충성고객) |
1 |
3 |
0.006944444 |
| 3회이상(충성고객) |
2 |
2 |
0.004629630 |
# 테이블 횟수
ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
count(구매횟수 = factor(구매횟수), 테이블주문수 = 회수_테이블) %>%
mutate(구성비 = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = 구성비, fill = 테이블주문수, label = scales::percent(구성비))) +
geom_bar(stat = 'identity', position='fill', alpha=0.8) +
geom_text(position = position_fill(vjust = .5), # move to center of bars
size = 3,color="white") +
scale_y_continuous(labels = scales::percent) +
labs(title="MORDER 구매 단계별 테이블 주문 횟수 분포 현황 (카페리피)") +
theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
count(구매횟수 = factor(구매횟수), 테이블주문수 = 회수_테이블) %>%
mutate(구성비 = prop.table(n)) %>% gt()
| 구매횟수 |
테이블주문수 |
n |
구성비 |
| 1회(참여고객) |
0 |
26 |
0.060185185 |
| 1회(참여고객) |
1 |
326 |
0.754629630 |
| 2회(유지고객) |
0 |
3 |
0.006944444 |
| 2회(유지고객) |
1 |
6 |
0.013888889 |
| 2회(유지고객) |
2 |
40 |
0.092592593 |
| 3회이상(충성고객) |
0 |
7 |
0.016203704 |
| 3회이상(충성고객) |
1 |
4 |
0.009259259 |
| 3회이상(충성고객) |
2 |
1 |
0.002314815 |
| 3회이상(충성고객) |
3 |
9 |
0.020833333 |
| 3회이상(충성고객) |
4 |
4 |
0.009259259 |
| 3회이상(충성고객) |
5 |
3 |
0.006944444 |
| 3회이상(충성고객) |
7 |
2 |
0.004629630 |
| 3회이상(충성고객) |
17 |
1 |
0.002314815 |
# 엠페이등록수
ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
count(구매횟수 = factor(구매횟수), 엠페이등록수 = 엠페이등록) %>%
mutate(구성비 = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = 구성비 , fill = 엠페이등록수, label = scales::percent(구성비))) +
geom_bar(stat = 'identity', position='fill', alpha=0.8) +
geom_text(position = position_fill(vjust = .5), # move to center of bars
size = 3,color="white") +
scale_y_continuous(labels = scales::percent)+
labs(title="MORDER 구매 단계별 엠페이 등록 횟수 분포 현황 (카페리피)") +
theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
count(구매횟수 = factor(구매횟수), 엠페이등록수 = 엠페이등록) %>%
mutate(구성비 = prop.table(n)) %>% gt()
| 구매횟수 |
엠페이등록수 |
n |
구성비 |
| 1회(참여고객) |
Y |
8 |
0.018518519 |
| 1회(참여고객) |
NA |
344 |
0.796296296 |
| 2회(유지고객) |
Y |
4 |
0.009259259 |
| 2회(유지고객) |
NA |
45 |
0.104166667 |
| 3회이상(충성고객) |
Y |
3 |
0.006944444 |
| 3회이상(충성고객) |
NA |
28 |
0.064814815 |
# 스탬프적립수
ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
count(구매횟수 = factor(구매횟수), 스탬프적립수 = 스탬프적립) %>%
mutate(구성비 = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = 구성비 , fill = 스탬프적립수, label = scales::percent(구성비))) +
geom_bar(stat = 'identity', position='fill', alpha=0.8) +
geom_text(position = position_fill(vjust = .5), # move to center of bars
size = 3,color="white")+
scale_y_continuous(labels = scales::percent)+
labs(title="MORDER 구매 단계별 스탬프 적립 횟수 분포 현황 (카페리피)") +
theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
count(구매횟수 = factor(구매횟수), 스탬프적립수 = 스탬프적립) %>%
mutate(구성비 = prop.table(n)) %>% gt()
| 구매횟수 |
스탬프적립수 |
n |
구성비 |
| 1회(참여고객) |
0 |
352 |
0.81481481 |
| 2회(유지고객) |
0 |
49 |
0.11342593 |
| 3회이상(충성고객) |
0 |
31 |
0.07175926 |
# 온라인 쿠폰발급수
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',], aes(x = 온라인쿠폰발급)) + xlab("온라인쿠폰발급수") + ylab("Density") + labs(title="MORDER 구매 단계별 온라인 쿠폰 발급 수 분포 현황 (카페리피)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(온라인쿠폰발급,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(온라인쿠폰발급,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
2 |
| 2회(유지고객) |
4 |
| 3회이상(충성고객) |
5 |
# 온라인 쿠폰사용수
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',], aes(x = 온라인쿠폰사용)) + xlab("온라인쿠폰사용수") + ylab("Density") + scale_x_continuous(breaks=seq(0, 1000, 1)) + labs(title="MORDER 구매 단계별 온라인 쿠폰 사용 수 분포 현황 (카페리피)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(온라인쿠폰사용,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(온라인쿠폰사용,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
1 |
| 2회(유지고객) |
1 |
| 3회이상(충성고객) |
2 |
# 온라인 쿠폰사용률
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',], aes(x = as.numeric(온라인쿠폰사용)/as.numeric(온라인쿠폰발급))) + xlab("온라인쿠폰사용률") + ylab("Density") + labs(title="MORDER 구매 단계별 온라인 쿠폰 사용률 분포 현황 (카페리피) \n (* 사용률 = 사용수/발급수)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(as.numeric(온라인쿠폰사용)/as.numeric(온라인쿠폰발급),na.rm=T ))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(as.numeric(온라인쿠폰사용)/as.numeric(온라인쿠폰발급),na.rm=T )) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
0.5000000 |
| 2회(유지고객) |
0.2500000 |
| 3회이상(충성고객) |
0.3333333 |
# 오프라인 쿠폰발급수
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',], aes(x = 오프라인쿠폰발급))+ xlab("오프라인쿠폰발급수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 오프라인 쿠폰 발급 수 분포 현황 (카페리피)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(오프라인쿠폰발급,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(오프라인쿠폰발급,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
0 |
| 2회(유지고객) |
0 |
| 3회이상(충성고객) |
1 |
# 오프라인 쿠폰사용수
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',], aes(x = 오프라인쿠폰사용)) + xlab("오프라인쿠폰사용수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 오프라인 쿠폰 사용 수 분포 현황 (카페리피)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(오프라인쿠폰사용,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(오프라인쿠폰사용,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
0 |
| 2회(유지고객) |
0 |
| 3회이상(충성고객) |
0 |
# 오프라인 쿠폰사용률
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',], aes(x = as.numeric(오프라인쿠폰사용)/as.numeric(오프라인쿠폰발급))) + xlab("오프라인쿠폰사용률") + ylab("Density") + labs(title="MORDER 구매 단계별 오프라인 쿠폰 사용률 분포 현황 (카페리피) \n (* 사용률 = 사용수/발급수)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(as.numeric(오프라인쿠폰사용)/as.numeric(오프라인쿠폰발급), na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(as.numeric(오프라인쿠폰사용)/as.numeric(오프라인쿠폰발급), na.rm=T))%>%gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
0 |
| 2회(유지고객) |
0 |
| 3회이상(충성고객) |
0 |
# 주중 / 주말 - 점심 / 저녁 / 스윙 /기타시간
# 주중
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',], aes(x = 주중)) + xlab("주중주문수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 주중 주문 수 분포 현황 (카페리피) ") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(주중,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(주중,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
1 |
| 2회(유지고객) |
1 |
| 3회이상(충성고객) |
2 |
#주말
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',], aes(x = 주말)) + xlab("주말주문수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 주말 주문 수 분포 현황 (카페리피) ") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(주말,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(주말,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
0 |
| 2회(유지고객) |
1 |
| 3회이상(충성고객) |
1 |
#점심
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',], aes(x = 점심)) + xlab("점심주문수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 점심 시간대 주문 수 분포 현황 (카페리피) ") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(점심,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(점심,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
1 |
| 2회(유지고객) |
1 |
| 3회이상(충성고객) |
2 |
#저녁
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',], aes(x = 저녁)) + xlab("저녁주문수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 저녁 시간대 주문 수 분포 현황 (카페리피) ") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(저녁,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(저녁,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
0 |
| 2회(유지고객) |
0 |
| 3회이상(충성고객) |
0 |
#스윙
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',], aes(x = 스윙)) + xlab("스윙주문수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 스윙 시간대 주문 수 분포 현황 (카페리피) ") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(스윙,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명=='카페리피',] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(스윙,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
0 |
| 2회(유지고객) |
0 |
| 3회이상(충성고객) |
1 |
###################################################################################################################################
# 환공어묵
#성별
ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
count(구매횟수 = factor(구매횟수), 성별 = factor(성별)) %>%
mutate(구성비 = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = 구성비, fill = 성별, label = scales::percent(구성비))) +
geom_col(position = 'dodge') +
geom_text(position = position_dodge(width = .9), # move to center of bars
vjust = -0.5, # nudge above top of bar
size = 3) +
scale_y_continuous(labels = scales::percent) +
labs(title="MORDER 구매 단계별 성별 분포 현황 (환공어묵)") +
theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
count(구매횟수 = factor(구매횟수), 성별 = factor(성별)) %>%
mutate(구성비 = prop.table(n)) %>% gt()
| 구매횟수 |
성별 |
n |
구성비 |
| 1회(참여고객) |
남자 |
112 |
0.278606965 |
| 1회(참여고객) |
없음 |
3 |
0.007462687 |
| 1회(참여고객) |
여자 |
246 |
0.611940299 |
| 2회(유지고객) |
남자 |
10 |
0.024875622 |
| 2회(유지고객) |
여자 |
11 |
0.027363184 |
| 3회이상(충성고객) |
남자 |
6 |
0.014925373 |
| 3회이상(충성고객) |
여자 |
14 |
0.034825871 |
#나이
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),], aes(x = 나이))+ xlab("나이") + ylab("Density") + labs(title="MORDER 구매 단계별 나이 분포 현황 (환공어묵)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(grp.mean = mean(나이,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(나이,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
34 |
| 2회(유지고객) |
42 |
| 3회이상(충성고객) |
44 |
# 가입경과일
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),], aes(x = 가입경과일))+ xlab("가입경과일") + ylab("Density") + labs(title="MORDER 구매 단계별 가입 경과일 분포 현황 (환공어묵)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(가입경과일,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(가입경과일,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
77 |
| 2회(유지고객) |
109 |
| 3회이상(충성고객) |
119 |
# 결제금액 (중앙값)
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),], aes(x = 결제금액_전체)) + xlab("결제금액") + ylab("Density") + labs(title="MORDER 구매 단계별 결제 금액 분포 현황 (환공어묵)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(결제금액_전체,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(결제금액_전체,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
16400 |
| 2회(유지고객) |
24400 |
| 3회이상(충성고객) |
49700 |
# 빌단가 ( 결제금액_전체 / 주문회수_전체 ) 중앙값
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),], aes(x = as.numeric(결제금액_전체) / as.numeric(주문회수_전체))) + xlab("빌단가") + ylab("Density") + labs(title="MORDER 구매 단계별 빌단가 분포 현황 (환공어묵)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(as.numeric(결제금액_전체) / as.numeric(주문회수_전체),na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(as.numeric(결제금액_전체) / as.numeric(주문회수_전체),na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
16400.00 |
| 2회(유지고객) |
13000.00 |
| 3회이상(충성고객) |
14858.33 |
# 첫주문일 - 가입일 (최초주문시까지 경과일)
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),], aes(x = 리드타임)) + xlab("첫주문 리드타임") + ylab("Density") + xlab("빌단가") + ylab("Density") + labs(title="MORDER 구매 단계별 첫주문 리드타임 분포 현황 (환공어묵)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(리드타임),na.rm=T)
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(리드타임),na.rm=T) %>% gt()
| 구매횟수 |
중앙값 |
na.rm |
| 1회(참여고객) |
0 |
TRUE |
| 2회(유지고객) |
0 |
TRUE |
| 3회이상(충성고객) |
0 |
TRUE |
# 픽업 횟수
ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
count(구매횟수 = factor(구매횟수), 픽업주문수 = 회수_픽업) %>%
mutate(구성비 = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = 구성비, fill = 픽업주문수, label = scales::percent(구성비))) +
geom_bar(stat = 'identity', position='fill', alpha=0.8) +
geom_text(position = position_fill(vjust = .5), # move to center of bars
size = 3,color="white") +
scale_y_continuous(labels = scales::percent) +
labs(title="MORDER 구매 단계별 픽업 횟수 분포 현황 (환공어묵)") +
theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
count(구매횟수 = factor(구매횟수), 픽업주문수 = 회수_픽업) %>%
mutate(구성비 = prop.table(n)) %>% gt()
| 구매횟수 |
픽업주문수 |
n |
구성비 |
| 1회(참여고객) |
0 |
279 |
0.694029851 |
| 1회(참여고객) |
1 |
82 |
0.203980100 |
| 2회(유지고객) |
0 |
12 |
0.029850746 |
| 2회(유지고객) |
1 |
1 |
0.002487562 |
| 2회(유지고객) |
2 |
8 |
0.019900498 |
| 3회이상(충성고객) |
0 |
4 |
0.009950249 |
| 3회이상(충성고객) |
1 |
2 |
0.004975124 |
| 3회이상(충성고객) |
2 |
1 |
0.002487562 |
| 3회이상(충성고객) |
3 |
7 |
0.017412935 |
| 3회이상(충성고객) |
4 |
3 |
0.007462687 |
| 3회이상(충성고객) |
5 |
1 |
0.002487562 |
| 3회이상(충성고객) |
6 |
1 |
0.002487562 |
| 3회이상(충성고객) |
12 |
1 |
0.002487562 |
# 배달 횟수
ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
count(구매횟수 = factor(구매횟수), 배달주문수 = 회수_배달) %>%
mutate(구성비 = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = 구성비, fill = 배달주문수, label = scales::percent(구성비))) +
geom_bar(stat = 'identity', position='fill', alpha=0.8) +
geom_text(position = position_fill(vjust = .5), # move to center of bars
size = 3,color="white") +
scale_y_continuous(labels = scales::percent) +
labs(title="MORDER 구매 단계별 배달 횟수 분포 현황 (환공어묵)") +
theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
count(구매횟수 = factor(구매횟수), 배달주문수 = 회수_배달) %>%
mutate(구성비 = prop.table(n)) %>% gt()
| 구매횟수 |
배달주문수 |
n |
구성비 |
| 1회(참여고객) |
0 |
360 |
0.895522388 |
| 1회(참여고객) |
1 |
1 |
0.002487562 |
| 2회(유지고객) |
0 |
21 |
0.052238806 |
| 3회이상(충성고객) |
0 |
19 |
0.047263682 |
| 3회이상(충성고객) |
1 |
1 |
0.002487562 |
# 테이블 횟수
ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
count(구매횟수 = factor(구매횟수), 테이블주문수 = 회수_테이블) %>%
mutate(구성비 = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = 구성비, fill = 테이블주문수, label = scales::percent(구성비))) +
geom_bar(stat = 'identity', position='fill', alpha=0.8) +
geom_text(position = position_fill(vjust = .5), # move to center of bars
size = 3,color="white") +
scale_y_continuous(labels = scales::percent) +
labs(title="MORDER 구매 단계별 테이블 주문 횟수 분포 현황 (환공어묵)") +
theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
count(구매횟수 = factor(구매횟수), 테이블주문수 = 회수_테이블) %>%
mutate(구성비 = prop.table(n)) %>% gt()
| 구매횟수 |
테이블주문수 |
n |
구성비 |
| 1회(참여고객) |
0 |
83 |
0.206467662 |
| 1회(참여고객) |
1 |
278 |
0.691542289 |
| 2회(유지고객) |
0 |
9 |
0.022388060 |
| 2회(유지고객) |
1 |
1 |
0.002487562 |
| 2회(유지고객) |
2 |
11 |
0.027363184 |
| 3회이상(충성고객) |
0 |
15 |
0.037313433 |
| 3회이상(충성고객) |
1 |
2 |
0.004975124 |
| 3회이상(충성고객) |
3 |
3 |
0.007462687 |
# 엠페이등록수
ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
count(구매횟수 = factor(구매횟수), 엠페이등록수 = 엠페이등록) %>%
mutate(구성비 = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = 구성비 , fill = 엠페이등록수, label = scales::percent(구성비))) +
geom_bar(stat = 'identity', position='fill', alpha=0.8) +
geom_text(position = position_fill(vjust = .5), # move to center of bars
size = 3,color="white") +
scale_y_continuous(labels = scales::percent)+
labs(title="MORDER 구매 단계별 엠페이 등록 횟수 분포 현황 (환공어묵)") +
theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
count(구매횟수 = factor(구매횟수), 엠페이등록수 = 엠페이등록) %>%
mutate(구성비 = prop.table(n)) %>% gt()
| 구매횟수 |
엠페이등록수 |
n |
구성비 |
| 1회(참여고객) |
Y |
3 |
0.007462687 |
| 1회(참여고객) |
NA |
358 |
0.890547264 |
| 2회(유지고객) |
NA |
21 |
0.052238806 |
| 3회이상(충성고객) |
Y |
3 |
0.007462687 |
| 3회이상(충성고객) |
NA |
17 |
0.042288557 |
# 스탬프적립수
ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
count(구매횟수 = factor(구매횟수), 스탬프적립수 = 스탬프적립) %>%
mutate(구성비 = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = 구성비 , fill = 스탬프적립수, label = scales::percent(구성비))) +
geom_bar(stat = 'identity', position='fill', alpha=0.8) +
geom_text(position = position_fill(vjust = .5), # move to center of bars
size = 3,color="white")+
scale_y_continuous(labels = scales::percent)+
labs(title="MORDER 구매 단계별 스탬프 적립 횟수 분포 현황 (환공어묵)") +
theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
count(구매횟수 = factor(구매횟수), 스탬프적립수 = 스탬프적립) %>%
mutate(구성비 = prop.table(n)) %>% gt()
| 구매횟수 |
스탬프적립수 |
n |
구성비 |
| 1회(참여고객) |
0 |
361 |
0.89800995 |
| 2회(유지고객) |
0 |
21 |
0.05223881 |
| 3회이상(충성고객) |
0 |
20 |
0.04975124 |
# 온라인 쿠폰발급수
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),], aes(x = 온라인쿠폰발급)) + xlab("온라인쿠폰발급수") + ylab("Density") + labs(title="MORDER 구매 단계별 온라인 쿠폰 발급 수 분포 현황 (환공어묵)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(온라인쿠폰발급,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(온라인쿠폰발급,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
1 |
| 2회(유지고객) |
2 |
| 3회이상(충성고객) |
4 |
# 온라인 쿠폰사용수
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),], aes(x = 온라인쿠폰사용)) + xlab("온라인쿠폰사용수") + ylab("Density") + scale_x_continuous(breaks=seq(0, 1000, 1)) + labs(title="MORDER 구매 단계별 온라인 쿠폰 사용 수 분포 현황 (환공어묵)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(온라인쿠폰사용,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(온라인쿠폰사용,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
1 |
| 2회(유지고객) |
1 |
| 3회이상(충성고객) |
1 |
# 온라인 쿠폰사용률
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),], aes(x = as.numeric(온라인쿠폰사용)/as.numeric(온라인쿠폰발급))) + xlab("온라인쿠폰사용률") + ylab("Density") + labs(title="MORDER 구매 단계별 온라인 쿠폰 사용률 분포 현황 (환공어묵) \n (* 사용률 = 사용수/발급수)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(as.numeric(온라인쿠폰사용)/as.numeric(온라인쿠폰발급),na.rm=T ))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(as.numeric(온라인쿠폰사용)/as.numeric(온라인쿠폰발급),na.rm=T )) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
1.0000000 |
| 2회(유지고객) |
0.3333333 |
| 3회이상(충성고객) |
0.2361111 |
# 오프라인 쿠폰발급수
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),], aes(x = 오프라인쿠폰발급))+ xlab("오프라인쿠폰발급수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 오프라인 쿠폰 발급 수 분포 현황 (환공어묵)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(오프라인쿠폰발급,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(오프라인쿠폰발급,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
1 |
| 2회(유지고객) |
1 |
| 3회이상(충성고객) |
1 |
# 오프라인 쿠폰사용수
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),], aes(x = 오프라인쿠폰사용)) + xlab("오프라인쿠폰사용수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 오프라인 쿠폰 사용 수 분포 현황 (환공어묵)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(오프라인쿠폰사용,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(오프라인쿠폰사용,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
0 |
| 2회(유지고객) |
0 |
| 3회이상(충성고객) |
0 |
# 오프라인 쿠폰사용률
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),], aes(x = as.numeric(오프라인쿠폰사용)/as.numeric(오프라인쿠폰발급))) + xlab("오프라인쿠폰사용률") + ylab("Density") + labs(title="MORDER 구매 단계별 오프라인 쿠폰 사용률 분포 현황 (환공어묵) \n (* 사용률 = 사용수/발급수)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(as.numeric(오프라인쿠폰사용)/as.numeric(오프라인쿠폰발급), na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(as.numeric(오프라인쿠폰사용)/as.numeric(오프라인쿠폰발급), na.rm=T))%>%gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
0 |
| 2회(유지고객) |
0 |
| 3회이상(충성고객) |
0 |
# 주중 / 주말 - 점심 / 저녁 / 스윙 /기타시간
# 주중
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),], aes(x = 주중)) + xlab("주중주문수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 주중 주문 수 분포 현황 (환공어묵) ") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(주중,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(주중,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
1.0 |
| 2회(유지고객) |
2.0 |
| 3회이상(충성고객) |
2.5 |
#주말
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),], aes(x = 주말)) + xlab("주말주문수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 주말 주문 수 분포 현황 (환공어묵) ") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(주말,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(주말,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
0 |
| 2회(유지고객) |
0 |
| 3회이상(충성고객) |
0 |
#점심
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),], aes(x = 점심)) + xlab("점심주문수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 점심 시간대 주문 수 분포 현황 (환공어묵) ") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(점심,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(점심,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
0 |
| 2회(유지고객) |
0 |
| 3회이상(충성고객) |
0 |
#저녁
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),], aes(x = 저녁)) + xlab("저녁주문수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 저녁 시간대 주문 수 분포 현황 (환공어묵) ") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(저녁,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(저녁,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
0 |
| 2회(유지고객) |
0 |
| 3회이상(충성고객) |
1 |
#스윙
a <- ggplot(ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),], aes(x = 스윙)) + xlab("스윙주문수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 스윙 시간대 주문 수 분포 현황 (환공어묵) ") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(스윙,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_bs_raw[ord_bs_raw$그룹기준브랜드명 %in% c('환공어묵','환공어묵 '),] %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(스윙,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 1회(참여고객) |
0.0 |
| 2회(유지고객) |
0.0 |
| 3회이상(충성고객) |
0.5 |
###################################################################################################################################
# 여러 브랜드 주문자
ord_brand_c %>% gt()
| 회원일련번호 |
이름 |
성별 |
나이 |
가입일 |
가입경과일 |
거주지 |
그룹기준브랜드 |
그룹기준브랜드명 |
주문회수_전체 |
결제금액_전체 |
빌단가_전체 |
첫주문일 |
최근주문일 |
최근주문경과일 |
회수_1년 |
금액_1년 |
회수_6개월 |
금액_6개월 |
회수_테이블 |
금액_테이블 |
회수_픽업 |
금액_픽업 |
회수_배달 |
금액_배달 |
회수_1년_테이블 |
회수_1년_픽업 |
회수_1년_배달 |
회수_6개월_테이블 |
회수_6개월_픽업 |
회수_6개월_배달 |
엠페이등록 |
스탬프적립 |
온라인쿠폰발급 |
온라인쿠폰사용 |
오프라인쿠폰발급 |
오프라인쿠폰사용 |
주중 |
주말 |
점심 |
스윙 |
저녁 |
기타시간 |
기간구분 |
ymd |
리드타임 |
brand |
구매횟수 |
| 232 |
우정식 |
남자 |
51 |
2020-09-10 00:00:00 |
249 |
경기 고양시 일산동구 숲속마을로 195 |
0 |
전체 |
3 |
42900 |
14300 |
2020-11-20 |
2020-12-22 |
146 |
3 |
42900 |
3 |
42900 |
3 |
42900 |
0 |
0 |
0 |
0 |
3 |
0 |
0 |
3 |
0 |
0 |
Y |
0 |
10 |
1 |
3 |
0 |
3 |
0 |
2 |
0 |
1 |
0 |
A |
2021-05-16 |
71 |
NA |
3회이상(충성고객) |
| 116 |
김설아 |
여자 |
31 |
2020-08-03 00:00:00 |
287 |
서울 마포구 포은로 21 |
0 |
전체 |
7 |
78700 |
11243 |
2020-08-03 |
2021-01-30 |
107 |
7 |
78700 |
1 |
5500 |
5 |
62700 |
2 |
16000 |
0 |
0 |
5 |
2 |
0 |
1 |
0 |
0 |
Y |
0 |
5 |
0 |
0 |
0 |
6 |
1 |
6 |
1 |
0 |
0 |
A |
2021-05-16 |
0 |
NA |
3회이상(충성고객) |
| 482 |
오세정 |
남자 |
43 |
2020-12-10 00:00:00 |
158 |
경기도 부천시 양지로 234-26 |
0 |
전체 |
7 |
140100 |
20014 |
2020-12-29 |
2021-02-16 |
90 |
7 |
140100 |
7 |
140100 |
0 |
0 |
4 |
86400 |
3 |
53700 |
0 |
4 |
3 |
0 |
4 |
3 |
Y |
0 |
48 |
4 |
3 |
1 |
7 |
0 |
7 |
0 |
0 |
0 |
A |
2021-05-16 |
19 |
NA |
3회이상(충성고객) |
| 526 |
조현진 |
남자 |
35 |
2020-12-22 00:00:00 |
146 |
서울 영등포구 영중로 119 |
0 |
전체 |
2 |
26700 |
13350 |
2020-12-22 |
2021-04-02 |
45 |
2 |
26700 |
2 |
26700 |
1 |
6500 |
0 |
0 |
1 |
20200 |
1 |
0 |
1 |
1 |
0 |
1 |
Y |
0 |
14 |
1 |
4 |
0 |
2 |
0 |
1 |
0 |
1 |
0 |
A |
2021-05-16 |
0 |
NA |
2회(유지고객) |
| 211 |
김석기 |
남자 |
51 |
2020-09-05 00:00:00 |
254 |
NA |
0 |
전체 |
2 |
29340 |
14670 |
2020-09-05 |
2020-11-07 |
191 |
2 |
29340 |
0 |
0 |
2 |
29340 |
0 |
0 |
0 |
0 |
2 |
0 |
0 |
0 |
0 |
0 |
NA |
0 |
6 |
2 |
3 |
0 |
0 |
2 |
1 |
1 |
0 |
0 |
A |
2021-05-16 |
0 |
NA |
2회(유지고객) |
| 225 |
손지혜 |
여자 |
43 |
2020-09-08 00:00:00 |
251 |
NA |
0 |
전체 |
3 |
28420 |
9473 |
2020-09-10 |
2020-11-09 |
189 |
3 |
28420 |
0 |
0 |
1 |
7420 |
2 |
21000 |
0 |
0 |
1 |
2 |
0 |
0 |
0 |
0 |
NA |
0 |
6 |
2 |
3 |
1 |
3 |
0 |
0 |
1 |
2 |
0 |
A |
2021-05-16 |
2 |
NA |
3회이상(충성고객) |
| 756 |
이정후 |
남자 |
32 |
2021-01-16 00:00:00 |
121 |
NA |
0 |
전체 |
7 |
104700 |
14957 |
2021-01-19 |
2021-02-10 |
96 |
7 |
104700 |
7 |
104700 |
0 |
0 |
7 |
104700 |
0 |
0 |
0 |
7 |
0 |
0 |
7 |
0 |
NA |
0 |
4 |
1 |
1 |
0 |
7 |
0 |
0 |
1 |
6 |
0 |
A |
2021-05-16 |
3 |
NA |
3회이상(충성고객) |
| 6126 |
이춘길 |
남자 |
49 |
2021-02-13 00:00:00 |
93 |
NA |
0 |
전체 |
4 |
55480 |
13870 |
2021-02-21 |
2021-04-07 |
40 |
4 |
55480 |
4 |
55480 |
1 |
10880 |
2 |
26600 |
1 |
18000 |
1 |
2 |
1 |
1 |
2 |
1 |
NA |
0 |
8 |
3 |
4 |
4 |
2 |
2 |
2 |
2 |
0 |
0 |
B |
2021-05-16 |
8 |
NA |
3회이상(충성고객) |
| 8579 |
이용석 |
남자 |
43 |
2021-02-14 00:00:00 |
92 |
NA |
0 |
전체 |
2 |
42030 |
21015 |
2021-03-19 |
2021-03-28 |
50 |
2 |
42030 |
2 |
42030 |
0 |
0 |
2 |
42030 |
0 |
0 |
0 |
2 |
0 |
0 |
2 |
0 |
NA |
0 |
8 |
1 |
4 |
0 |
1 |
1 |
1 |
1 |
0 |
0 |
B |
2021-05-16 |
33 |
NA |
2회(유지고객) |
| 8637 |
김승모 |
남자 |
51 |
2021-02-14 00:00:00 |
92 |
NA |
0 |
전체 |
7 |
134700 |
19243 |
2021-02-22 |
2021-05-15 |
2 |
7 |
134700 |
7 |
134700 |
0 |
0 |
0 |
0 |
7 |
134700 |
0 |
0 |
7 |
0 |
0 |
7 |
NA |
0 |
10 |
7 |
4 |
2 |
6 |
1 |
1 |
1 |
5 |
0 |
B |
2021-05-16 |
8 |
NA |
3회이상(충성고객) |
| 10535 |
이혜정 |
여자 |
26 |
2021-02-16 00:00:00 |
90 |
NA |
0 |
전체 |
2 |
42300 |
21150 |
2021-03-16 |
2021-05-03 |
14 |
2 |
42300 |
2 |
42300 |
1 |
4800 |
1 |
37500 |
0 |
0 |
1 |
1 |
0 |
1 |
1 |
0 |
Y |
1 |
10 |
1 |
5 |
1 |
2 |
0 |
1 |
1 |
0 |
0 |
B |
2021-05-16 |
28 |
NA |
2회(유지고객) |
| 11293 |
권정혜 |
여자 |
48 |
2021-02-17 00:00:00 |
89 |
경기도 안양시 만안구 덕천로 140 |
0 |
전체 |
3 |
54000 |
18000 |
2021-02-20 |
2021-02-21 |
85 |
3 |
54000 |
3 |
54000 |
0 |
0 |
3 |
54000 |
0 |
0 |
0 |
3 |
0 |
0 |
3 |
0 |
NA |
0 |
9 |
1 |
4 |
0 |
0 |
3 |
2 |
0 |
1 |
0 |
B |
2021-05-16 |
3 |
NA |
3회이상(충성고객) |
| 20338 |
민유홍 |
여자 |
55 |
2021-02-26 00:00:00 |
80 |
NA |
0 |
전체 |
3 |
44500 |
14833 |
2021-03-29 |
2021-04-30 |
17 |
3 |
44500 |
3 |
44500 |
0 |
0 |
1 |
15700 |
2 |
28800 |
0 |
1 |
2 |
0 |
1 |
2 |
NA |
0 |
8 |
3 |
1 |
0 |
3 |
0 |
2 |
1 |
0 |
0 |
B |
2021-05-16 |
31 |
NA |
3회이상(충성고객) |
| 103 |
NA |
없음 |
0 |
2020-07-22 00:00:00 |
299 |
NA |
0 |
전체 |
7 |
194400 |
27771 |
2020-08-03 |
2020-12-02 |
166 |
7 |
194400 |
1 |
63600 |
3 |
71800 |
3 |
91600 |
1 |
31000 |
3 |
3 |
1 |
0 |
1 |
0 |
NA |
0 |
1 |
1 |
0 |
0 |
6 |
1 |
5 |
2 |
0 |
0 |
A |
2021-05-16 |
12 |
NA |
3회이상(충성고객) |
#성별
ord_brand_c %>%
count(구매횟수 = factor(구매횟수), 성별 = factor(성별)) %>%
mutate(구성비 = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = 구성비, fill = 성별, label = scales::percent(구성비))) +
geom_col(position = 'dodge') +
geom_text(position = position_dodge(width = .9), # move to center of bars
vjust = -0.5, # nudge above top of bar
size = 3) +
scale_y_continuous(labels = scales::percent) +
labs(title="MORDER 구매 단계별 성별 분포 현황 (다 브랜드)") +
theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_brand_c %>%
count(구매횟수 = factor(구매횟수), 성별 = factor(성별)) %>%
mutate(구성비 = prop.table(n)) %>% gt()
| 구매횟수 |
성별 |
n |
구성비 |
| 2회(유지고객) |
남자 |
3 |
0.21428571 |
| 2회(유지고객) |
여자 |
1 |
0.07142857 |
| 3회이상(충성고객) |
남자 |
5 |
0.35714286 |
| 3회이상(충성고객) |
없음 |
1 |
0.07142857 |
| 3회이상(충성고객) |
여자 |
4 |
0.28571429 |
#나이
a <- ggplot(ord_brand_c, aes(x = 나이))+ xlab("나이") + ylab("Density") + labs(title="MORDER 구매 단계별 나이 분포 현황 (다 브랜드)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_brand_c %>%
group_by(구매횟수) %>%
summarise(grp.mean = mean(나이,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_brand_c %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(나이,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 2회(유지고객) |
39.0 |
| 3회이상(충성고객) |
45.5 |
# 가입경과일
a <- ggplot(ord_brand_c, aes(x = 가입경과일))+ xlab("가입경과일") + ylab("Density") + labs(title="MORDER 구매 단계별 가입 경과일 분포 현황 (다 브랜드)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_brand_c %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(가입경과일,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_brand_c %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(가입경과일,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 2회(유지고객) |
119.0 |
| 3회이상(충성고객) |
139.5 |
# 결제금액 (중앙값)
a <- ggplot(ord_brand_c, aes(x = 결제금액_전체)) + xlab("결제금액") + ylab("Density") + labs(title="MORDER 구매 단계별 결제 금액 분포 현황 (다 브랜드)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_brand_c %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(결제금액_전체,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_brand_c %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(결제금액_전체,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 2회(유지고객) |
35685 |
| 3회이상(충성고객) |
67090 |
# 빌단가 ( 결제금액_전체 / 주문회수_전체 ) 중앙값
a <- ggplot(ord_brand_c, aes(x = as.numeric(결제금액_전체) / as.numeric(주문회수_전체))) + xlab("빌단가") + ylab("Density") + labs(title="MORDER 구매 단계별 빌단가 분포 현황 (다 브랜드)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_brand_c %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(as.numeric(결제금액_전체) / as.numeric(주문회수_전체),na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_brand_c %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(as.numeric(결제금액_전체) / as.numeric(주문회수_전체),na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 2회(유지고객) |
17842.50 |
| 3회이상(충성고객) |
14895.24 |
# 첫주문일 - 가입일 (최초주문시까지 경과일)
a <- ggplot(ord_brand_c, aes(x = 리드타임)) + xlab("첫주문 리드타임") + ylab("Density") + xlab("빌단가") + ylab("Density") + labs(title="MORDER 구매 단계별 첫주문 리드타임 분포 현황 (다 브랜드)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_brand_c %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(리드타임),na.rm=T)
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_brand_c %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(리드타임),na.rm=T) %>% gt()
| 구매횟수 |
중앙값 |
na.rm |
| 2회(유지고객) |
14 |
TRUE |
| 3회이상(충성고객) |
8 |
TRUE |
# 픽업 횟수
ord_brand_c %>%
count(구매횟수 = factor(구매횟수), 픽업주문수 = 회수_픽업) %>%
mutate(구성비 = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = 구성비, fill = 픽업주문수, label = scales::percent(구성비))) +
geom_bar(stat = 'identity', position='fill', alpha=0.8) +
geom_text(position = position_fill(vjust = .5), # move to center of bars
size = 3,color="white") +
scale_y_continuous(labels = scales::percent) +
labs(title="MORDER 구매 단계별 픽업 횟수 분포 현황 (다 브랜드)") +
theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_brand_c %>%
count(구매횟수 = factor(구매횟수), 픽업주문수 = 회수_픽업) %>%
mutate(구성비 = prop.table(n)) %>% gt()
| 구매횟수 |
픽업주문수 |
n |
구성비 |
| 2회(유지고객) |
0 |
2 |
0.14285714 |
| 2회(유지고객) |
1 |
1 |
0.07142857 |
| 2회(유지고객) |
2 |
1 |
0.07142857 |
| 3회이상(충성고객) |
0 |
2 |
0.14285714 |
| 3회이상(충성고객) |
1 |
1 |
0.07142857 |
| 3회이상(충성고객) |
2 |
3 |
0.21428571 |
| 3회이상(충성고객) |
3 |
2 |
0.14285714 |
| 3회이상(충성고객) |
4 |
1 |
0.07142857 |
| 3회이상(충성고객) |
7 |
1 |
0.07142857 |
# 배달 횟수
ord_brand_c %>%
count(구매횟수 = factor(구매횟수), 배달주문수 = 회수_배달) %>%
mutate(구성비 = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = 구성비, fill = 배달주문수, label = scales::percent(구성비))) +
geom_bar(stat = 'identity', position='fill', alpha=0.8) +
geom_text(position = position_fill(vjust = .5), # move to center of bars
size = 3,color="white") +
scale_y_continuous(labels = scales::percent) +
labs(title="MORDER 구매 단계별 배달 횟수 분포 현황 (다 브랜드)") +
theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_brand_c %>%
count(구매횟수 = factor(구매횟수), 배달주문수 = 회수_배달) %>%
mutate(구성비 = prop.table(n)) %>% gt()
| 구매횟수 |
배달주문수 |
n |
구성비 |
| 2회(유지고객) |
0 |
3 |
0.21428571 |
| 2회(유지고객) |
1 |
1 |
0.07142857 |
| 3회이상(충성고객) |
0 |
5 |
0.35714286 |
| 3회이상(충성고객) |
1 |
2 |
0.14285714 |
| 3회이상(충성고객) |
2 |
1 |
0.07142857 |
| 3회이상(충성고객) |
3 |
1 |
0.07142857 |
| 3회이상(충성고객) |
7 |
1 |
0.07142857 |
# 테이블 횟수
ord_brand_c %>%
count(구매횟수 = factor(구매횟수), 테이블주문수 = 회수_테이블) %>%
mutate(구성비 = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = 구성비, fill = 테이블주문수, label = scales::percent(구성비))) +
geom_bar(stat = 'identity', position='fill', alpha=0.8) +
geom_text(position = position_fill(vjust = .5), # move to center of bars
size = 3,color="white") +
scale_y_continuous(labels = scales::percent) +
labs(title="MORDER 구매 단계별 테이블 주문 횟수 분포 현황 (다 브랜드)") +
theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_brand_c %>%
count(구매횟수 = factor(구매횟수), 테이블주문수 = 회수_테이블) %>%
mutate(구성비 = prop.table(n)) %>% gt()
| 구매횟수 |
테이블주문수 |
n |
구성비 |
| 2회(유지고객) |
0 |
1 |
0.07142857 |
| 2회(유지고객) |
1 |
2 |
0.14285714 |
| 2회(유지고객) |
2 |
1 |
0.07142857 |
| 3회이상(충성고객) |
0 |
5 |
0.35714286 |
| 3회이상(충성고객) |
1 |
2 |
0.14285714 |
| 3회이상(충성고객) |
3 |
2 |
0.14285714 |
| 3회이상(충성고객) |
5 |
1 |
0.07142857 |
# 엠페이등록수
ord_brand_c %>%
count(구매횟수 = factor(구매횟수), 엠페이등록수 = 엠페이등록) %>%
mutate(구성비 = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = 구성비 , fill = 엠페이등록수, label = scales::percent(구성비))) +
geom_bar(stat = 'identity', position='fill', alpha=0.8) +
geom_text(position = position_fill(vjust = .5), # move to center of bars
size = 3,color="white") +
scale_y_continuous(labels = scales::percent)+
labs(title="MORDER 구매 단계별 엠페이 등록 횟수 분포 현황 (다 브랜드)") +
theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_brand_c %>%
count(구매횟수 = factor(구매횟수), 엠페이등록수 = 엠페이등록) %>%
mutate(구성비 = prop.table(n)) %>% gt()
| 구매횟수 |
엠페이등록수 |
n |
구성비 |
| 2회(유지고객) |
Y |
2 |
0.1428571 |
| 2회(유지고객) |
NA |
2 |
0.1428571 |
| 3회이상(충성고객) |
Y |
3 |
0.2142857 |
| 3회이상(충성고객) |
NA |
7 |
0.5000000 |
# 스탬프적립수
ord_brand_c %>%
count(구매횟수 = factor(구매횟수), 스탬프적립수 = 스탬프적립) %>%
mutate(구성비 = prop.table(n)) %>%
ggplot(aes(x = 구매횟수, y = 구성비 , fill = 스탬프적립수, label = scales::percent(구성비))) +
geom_bar(stat = 'identity', position='fill', alpha=0.8) +
geom_text(position = position_fill(vjust = .5), # move to center of bars
size = 3,color="white")+
scale_y_continuous(labels = scales::percent)+
labs(title="MORDER 구매 단계별 스탬프 적립 횟수 분포 현황 (다 브랜드)") +
theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))

ord_brand_c %>%
count(구매횟수 = factor(구매횟수), 스탬프적립수 = 스탬프적립) %>%
mutate(구성비 = prop.table(n)) %>% gt()
| 구매횟수 |
스탬프적립수 |
n |
구성비 |
| 2회(유지고객) |
0 |
3 |
0.21428571 |
| 2회(유지고객) |
1 |
1 |
0.07142857 |
| 3회이상(충성고객) |
0 |
10 |
0.71428571 |
# 온라인 쿠폰발급수
a <- ggplot(ord_brand_c, aes(x = 온라인쿠폰발급)) + xlab("온라인쿠폰발급수") + ylab("Density") + labs(title="MORDER 구매 단계별 온라인 쿠폰 발급 수 분포 현황 (다 브랜드)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_brand_c %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(온라인쿠폰발급,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_brand_c %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(온라인쿠폰발급,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 2회(유지고객) |
9 |
| 3회이상(충성고객) |
8 |
# 온라인 쿠폰사용수
a <- ggplot(ord_brand_c, aes(x = 온라인쿠폰사용)) + xlab("온라인쿠폰사용수") + ylab("Density") + scale_x_continuous(breaks=seq(0, 1000, 1)) + labs(title="MORDER 구매 단계별 온라인 쿠폰 사용 수 분포 현황 (다 브랜드)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_brand_c %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(온라인쿠폰사용,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_brand_c %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(온라인쿠폰사용,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 2회(유지고객) |
1.0 |
| 3회이상(충성고객) |
1.5 |
# 온라인 쿠폰사용률
a <- ggplot(ord_brand_c, aes(x = as.numeric(온라인쿠폰사용)/as.numeric(온라인쿠폰발급))) + xlab("온라인쿠폰사용률") + ylab("Density") + labs(title="MORDER 구매 단계별 온라인 쿠폰 사용률 분포 현황 (다 브랜드) \n (* 사용률 = 사용수/발급수)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_brand_c %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(as.numeric(온라인쿠폰사용)/as.numeric(온라인쿠폰발급),na.rm=T ))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_brand_c %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(as.numeric(온라인쿠폰사용)/as.numeric(온라인쿠폰발급),na.rm=T )) %>% gt()
| 구매횟수 |
중앙값 |
| 2회(유지고객) |
0.1125000 |
| 3회이상(충성고객) |
0.2916667 |
# 오프라인 쿠폰발급수
a <- ggplot(ord_brand_c, aes(x = 오프라인쿠폰발급))+ xlab("오프라인쿠폰발급수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 오프라인 쿠폰 발급 수 분포 현황 (다 브랜드)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_brand_c %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(오프라인쿠폰발급,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_brand_c %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(오프라인쿠폰발급,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 2회(유지고객) |
4 |
| 3회이상(충성고객) |
3 |
# 오프라인 쿠폰사용수
a <- ggplot(ord_brand_c, aes(x = 오프라인쿠폰사용)) + xlab("오프라인쿠폰사용수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 오프라인 쿠폰 사용 수 분포 현황 (다 브랜드)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_brand_c %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(오프라인쿠폰사용,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_brand_c %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(오프라인쿠폰사용,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 2회(유지고객) |
0 |
| 3회이상(충성고객) |
0 |
# 오프라인 쿠폰사용률
a <- ggplot(ord_brand_c, aes(x = as.numeric(오프라인쿠폰사용)/as.numeric(오프라인쿠폰발급))) + xlab("오프라인쿠폰사용률") + ylab("Density") + labs(title="MORDER 구매 단계별 오프라인 쿠폰 사용률 분포 현황 (다 브랜드) \n (* 사용률 = 사용수/발급수)") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_brand_c %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(as.numeric(오프라인쿠폰사용)/as.numeric(오프라인쿠폰발급), na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_brand_c %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(as.numeric(오프라인쿠폰사용)/as.numeric(오프라인쿠폰발급), na.rm=T))%>%gt()
| 구매횟수 |
중앙값 |
| 2회(유지고객) |
0.0000000 |
| 3회이상(충성고객) |
0.1666667 |
# 주중 / 주말 - 점심 / 저녁 / 스윙 /기타시간
# 주중
a <- ggplot(ord_brand_c, aes(x = 주중)) + xlab("주중주문수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 주중 주문 수 분포 현황 (다 브랜드) ") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_brand_c %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(주중,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_brand_c %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(주중,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 2회(유지고객) |
1.5 |
| 3회이상(충성고객) |
4.5 |
#주말
a <- ggplot(ord_brand_c, aes(x = 주말)) + xlab("주말주문수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 주말 주문 수 분포 현황 (다 브랜드) ") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_brand_c %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(주말,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_brand_c %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(주말,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 2회(유지고객) |
0.5 |
| 3회이상(충성고객) |
0.5 |
#점심
a <- ggplot(ord_brand_c, aes(x = 점심)) + xlab("점심주문수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 점심 시간대 주문 수 분포 현황 (다 브랜드) ") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_brand_c %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(점심,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_brand_c %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(점심,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 2회(유지고객) |
1 |
| 3회이상(충성고객) |
2 |
#저녁
a <- ggplot(ord_brand_c, aes(x = 저녁)) + xlab("저녁주문수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 저녁 시간대 주문 수 분포 현황 (다 브랜드) ") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_brand_c %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(저녁,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_brand_c %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(저녁,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 2회(유지고객) |
0.0 |
| 3회이상(충성고객) |
0.5 |
#스윙
a <- ggplot(ord_brand_c, aes(x = 스윙)) + xlab("스윙주문수") + ylab("Density") + scale_x_continuous(breaks=seq(0,1000,1)) + labs(title="MORDER 구매 단계별 스윙 시간대 주문 수 분포 현황 (다 브랜드) ") + theme(plot.title = element_text(hjust = 0.5),text = element_text(size=12))
mu <- ord_brand_c %>%
group_by(구매횟수) %>%
summarise(grp.mean = median(스윙,na.rm=T))
a + geom_density(aes(fill = 구매횟수), alpha = 0.4) +
geom_vline(aes(xintercept = grp.mean, color = 구매횟수),
data = mu, linetype = "dashed", size= 1)

ord_brand_c %>%
group_by(구매횟수) %>%
summarise(중앙값 = median(스윙,na.rm=T)) %>% gt()
| 구매횟수 |
중앙값 |
| 2회(유지고객) |
1 |
| 3회이상(충성고객) |
1 |